import Vue from "vue";
import App from "./App.vue";
import VueRouter from "vue-router"; // 1 引入VueRoute
import BaseFind from "./views/BaseFind.vue";
import BaseMy from "./views/BaseMy.vue";
import BaseFriend from "./views/BaseFriend.vue";

import BaseLogin from "./views/BaseLogin.vue";
import BaseLayout from "./views/BaseLayout.vue";

Vue.use(VueRouter); // 2 注册
const router = new VueRouter({
  routes: [
    {
      path: "/",
      component: BaseLayout,
      // 嵌套
      children: [
        {
          path: "find",
          component: BaseFind,
        },
        {
          path: "my",
          component: BaseMy,
        },
        {
          path: "friend",
          component: BaseFriend,
        },
      ],
    },
    // 登录页面
    {
      path: "/login",
      component: BaseLogin,
    },
  ],
}); // 3 创建路由对象
Vue.config.productionTip = false;

new Vue({
  render: (h) => h(App),
  router, // 4 将路由对象注入到new Vue实例中,建立关联
}).$mount("#app");
